package tester.input;

import messages.MessageType;

/**
 * This message is a tester specific message denoting that the tester must destroy an elevator
 * @author Caleb Chan
 *
 */
public class DestroyElevatorMessage extends TesterMessage {

	private byte elevatorId;
	
	/**
	 * DestroyElevatorMessage constructor
	 * @param data The data representation of a DestroyElevatorMessage
	 */
	public DestroyElevatorMessage(byte []data){
		this.elevatorId = data[1];
	}
	
	/**
	 * DestroyElevatorMessage constructor
	 * @param elevatorId The id of the elevator to destroy
	 */
	public DestroyElevatorMessage(byte elevatorId) {
		this.elevatorId = elevatorId;
	}

	/**
	 * This method returns the elevator to be destroyed
	 * @return Returns the elevator to be destroyed
	 */
	public byte getElevatorId(){
		return this.elevatorId;
	}
	
	@Override
	public MessageType getMessageType() {
		return null;
	}
	
	@Override
	public byte[] toByteArray(){
		byte[] out = new byte[2];
		out[0] = getTesterMessageType().getIdentifier();
		out[1] = elevatorId;
		
		return out;
	}

	@Override
	public TesterMessageType getTesterMessageType() {
		return TesterMessageType.DestroyElevatorMessage;
	}

}
